package com.erlang.spring.mapper;

import com.erlang.spring.pojo.Account;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 自定义mapper映射器
 *
 * @author ZGQ
 */
public class AccountMapper implements RowMapper<Account> {
  @Override
  public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
    Account account = new Account();
    account.setId(rs.getInt("id"));
    account.setAccountName(rs.getString("account_name"));
    account.setMoney(rs.getFloat("money"));
    return account;
  }
}
